-
Notifications
You must be signed in to change notification settings - Fork 22
CASSANALYTICS-79: Make Token ranges calculation rack aware for spark.data.partitioner.CassandraRing #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
| return new long[]{h1, h2}; | ||
| } | ||
|
|
||
| protected static long invRShiftXor(long value, int shift) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are those new methods added?
| private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException | ||
| { | ||
| this.token = in.readUTF(); | ||
| this.node = in.readUTF(); | ||
| this.dataCenter = in.readUTF(); | ||
| } | ||
|
|
||
| private void writeObject(ObjectOutputStream out) throws IOException | ||
| { | ||
| out.writeUTF(token()); | ||
| out.writeUTF(nodeName()); | ||
| out.writeUTF(dataCenter()); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why adding the custom serialization code? The string fields should be serializable by default, and the readObject & writeObject methods are unnecessary.
| private final String token; | ||
| private final String node; | ||
| private final String dataCenter; | ||
| private String token; | ||
| private String node; | ||
| private String dataCenter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once readObject & writeObject are removed, the final modifiers can be restored.
| private transient RangeMap<BigInteger, List<CassandraInstance>> replicasForRanges; | ||
| private transient RangeMap<BigInteger, List<CassandraInstance>> replicas; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is confusing to have 2 maps and they actually point to the same object if I am not mistaken.
More importantly, it leads to different init code paths. The patch is to fix the broken token calculation, but why leaving it half-fixed? The CDC code patch still calls the original constructor, which means CDC is still broken.
| //updateInternal(1, key, VALUE2); | ||
| //expectedValuesInNodes.put(1, VALUE2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are those 2 lines wanted?
Changes in the PR: